package com.skywolf.chem.home.service.impl;

import com.skywolf.chem.common.sysconfig.pojo.vo.PageVO;
import com.skywolf.chem.home.entity.LoopImg;
import com.skywolf.chem.home.entity.LoopImgVo;
import com.skywolf.chem.home.mapper.LoopImgMapper;
import com.skywolf.chem.home.param.LoopImgParam;
import com.skywolf.chem.home.service.ILoopImgService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.skywolf.chem.live.param.CommentDto;
import com.skywolf.chem.manager.param.LoopImgManagerParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 
 * @since 2020-12-15
 */
@Service
public class LoopImgServiceImpl extends ServiceImpl<LoopImgMapper, LoopImg> implements ILoopImgService {

    @Autowired
    LoopImgMapper loopImgMapper;

    @Override
    public List<LoopImgParam> getLoopImgs() {
        return loopImgMapper.getLoopImgs();
    }

    @Override
    public PageVO<LoopImgVo> pageLoopImgList(LoopImgManagerParam queryParam) {
        Long startNum = queryParam.getPageSize()*(queryParam.getPageNum()-1);
        Long endNum = queryParam.getPageSize();
        Integer count = loopImgMapper.getLoopImgPageCount();
        List<LoopImgVo> list = loopImgMapper.getLoopImgPageList(startNum,endNum);
        PageVO<LoopImgVo> pageVO = new PageVO(list,Long.valueOf(count),queryParam.getPageNum(),queryParam.getPageSize());
        return pageVO;
    }

    @Override
    public List<LoopImg> getLoopImgList() {
        return loopImgMapper.getLoopImgList();
    }

    @Override
    public LoopImg loopImgById(Integer id) {
        return loopImgMapper.loopImgById(id);
    }
}
